home *** CD-ROM | disk | FTP | other *** search
/ Kentucky Virtual Art Museum / Kentucky Virtual Art Museum.iso / site / museums / galleries / galleryPattern.swf / scripts / FUIComponentSymbol.as < prev   
Text File  |  2005-08-25  |  10KB  |  351 lines

  1. function FUIComponentClass()
  2. {
  3.    this.init();
  4. }
  5. FUIComponentClass.prototype = new MovieClip();
  6. FUIComponentClass.prototype.init = function()
  7. {
  8.    var _loc1_ = this;
  9.    var _loc3_ = _global;
  10.    _loc1_.enable = true;
  11.    _loc1_.focused = false;
  12.    _loc1_.useHandCursor = false;
  13.    _loc1_._accImpl = new Object();
  14.    _loc1_._accImpl.stub = true;
  15.    _loc1_.styleTable = new Array();
  16.    if(_loc3_.globalStyleFormat == undefined)
  17.    {
  18.       _loc3_.globalStyleFormat = new FStyleFormat();
  19.       globalStyleFormat.isGlobal = true;
  20.       _loc3_._focusControl = new Object();
  21.       _loc3_._focusControl.onSetFocus = function(oldFocus, newFocus)
  22.       {
  23.          oldFocus.myOnKillFocus();
  24.          newFocus.myOnSetFocus();
  25.       };
  26.       Selection.addListener(_loc3_._focusControl);
  27.    }
  28.    if(_loc1_._name != undefined)
  29.    {
  30.       _loc1_._focusrect = false;
  31.       _loc1_.tabEnabled = true;
  32.       _loc1_.focusEnabled = true;
  33.       _loc1_.tabChildren = false;
  34.       _loc1_.tabFocused = true;
  35.       if(_loc1_.hostStyle == undefined)
  36.       {
  37.          globalStyleFormat.addListener(_loc1_);
  38.       }
  39.       else
  40.       {
  41.          _loc1_.styleTable = _loc1_.hostStyle;
  42.       }
  43.       _loc1_.deadPreview._visible = false;
  44.       _loc1_.deadPreview._width = _loc1_.deadPreview._height = 1;
  45.       _loc1_.methodTable = new Object();
  46.       _loc1_.keyListener = new Object();
  47.       _loc1_.keyListener.controller = _loc1_;
  48.       _loc1_.keyListener.onKeyDown = function()
  49.       {
  50.          this.controller.myOnKeyDown();
  51.       };
  52.       _loc1_.keyListener.onKeyUp = function()
  53.       {
  54.          this.controller.myOnKeyUp();
  55.       };
  56.       for(var _loc2_ in _loc1_.styleFormat_prm)
  57.       {
  58.          _loc1_.setStyleProperty(_loc2_,_loc1_.styleFormat_prm[_loc2_]);
  59.       }
  60.    }
  61. };
  62. FUIComponentClass.prototype.setEnabled = function(enabledFlag)
  63. {
  64.    var _loc1_ = this;
  65.    _loc1_.enable = arguments.length <= 0 ? true : enabledFlag;
  66.    _loc1_.tabEnabled = _loc1_.focusEnabled = enabledFlag;
  67.    if(!_loc1_.enable && _loc1_.focused)
  68.    {
  69.       Selection.setFocus(undefined);
  70.    }
  71. };
  72. FUIComponentClass.prototype.getEnabled = function()
  73. {
  74.    return this.enable;
  75. };
  76. FUIComponentClass.prototype.setSize = function(w, h)
  77. {
  78.    var _loc1_ = this;
  79.    _loc1_.width = w;
  80.    _loc1_.height = h;
  81.    _loc1_.focusRect.removeMovieClip();
  82. };
  83. FUIComponentClass.prototype.setChangeHandler = function(chng, obj)
  84. {
  85.    var _loc1_ = this;
  86.    _loc1_.handlerObj = obj != undefined ? obj : _loc1_._parent;
  87.    _loc1_.changeHandler = chng;
  88. };
  89. FUIComponentClass.prototype.invalidate = function(methodName)
  90. {
  91.    var _loc1_ = this;
  92.    _loc1_.methodTable[methodName] = true;
  93.    _loc1_.onEnterFrame = _loc1_.cleanUI;
  94. };
  95. FUIComponentClass.prototype.cleanUI = function()
  96. {
  97.    var _loc1_ = this;
  98.    if(_loc1_.methodTable.setSize)
  99.    {
  100.       _loc1_.setSize(_loc1_.width,_loc1_.height);
  101.    }
  102.    else
  103.    {
  104.       _loc1_.cleanUINotSize();
  105.    }
  106.    _loc1_.methodTable = new Object();
  107.    delete _loc1_.onEnterFrame;
  108. };
  109. FUIComponentClass.prototype.cleanUINotSize = function()
  110. {
  111.    var _loc1_ = this;
  112.    for(var _loc2_ in _loc1_.methodTable)
  113.    {
  114.       _loc1_._loc2_();
  115.    }
  116. };
  117. FUIComponentClass.prototype.drawRect = function(x, y, w, h)
  118. {
  119.    var _loc1_ = this;
  120.    var _loc2_ = y;
  121.    var _loc3_ = x;
  122.    var inner = _loc1_.styleTable.focusRectInner.value;
  123.    var outer = _loc1_.styleTable.focusRectOuter.value;
  124.    if(inner == undefined)
  125.    {
  126.       inner = 16777215;
  127.    }
  128.    if(outer == undefined)
  129.    {
  130.       outer = 0;
  131.    }
  132.    _loc1_.createEmptyMovieClip("focusRect",1000);
  133.    _loc1_.focusRect.controller = _loc1_;
  134.    _loc1_.focusRect.lineStyle(1,outer);
  135.    _loc1_.focusRect.moveTo(_loc3_,_loc2_);
  136.    _loc1_.focusRect.lineTo(_loc3_ + w,_loc2_);
  137.    _loc1_.focusRect.lineTo(_loc3_ + w,_loc2_ + h);
  138.    _loc1_.focusRect.lineTo(_loc3_,_loc2_ + h);
  139.    _loc1_.focusRect.lineTo(_loc3_,_loc2_);
  140.    _loc1_.focusRect.lineStyle(1,inner);
  141.    _loc1_.focusRect.moveTo(_loc3_ + 1,_loc2_ + 1);
  142.    _loc1_.focusRect.lineTo(_loc3_ + w - 1,_loc2_ + 1);
  143.    _loc1_.focusRect.lineTo(_loc3_ + w - 1,_loc2_ + h - 1);
  144.    _loc1_.focusRect.lineTo(_loc3_ + 1,_loc2_ + h - 1);
  145.    _loc1_.focusRect.lineTo(_loc3_ + 1,_loc2_ + 1);
  146. };
  147. FUIComponentClass.prototype.pressFocus = function()
  148. {
  149.    var _loc1_ = this;
  150.    _loc1_.tabFocused = false;
  151.    _loc1_.focusRect.removeMovieClip();
  152.    Selection.setFocus(_loc1_);
  153. };
  154. FUIComponentClass.prototype.drawFocusRect = function()
  155. {
  156.    var _loc1_ = this;
  157.    _loc1_.drawRect(-2,-2,_loc1_.width + 4,_loc1_.height + 4);
  158. };
  159. FUIComponentClass.prototype.myOnSetFocus = function()
  160. {
  161.    var _loc1_ = this;
  162.    _loc1_.focused = true;
  163.    Key.addListener(_loc1_.keyListener);
  164.    if(_loc1_.tabFocused)
  165.    {
  166.       _loc1_.drawFocusRect();
  167.    }
  168. };
  169. FUIComponentClass.prototype.myOnKillFocus = function()
  170. {
  171.    var _loc1_ = this;
  172.    _loc1_.tabFocused = true;
  173.    _loc1_.focused = false;
  174.    _loc1_.focusRect.removeMovieClip();
  175.    Key.removeListener(_loc1_.keyListener);
  176. };
  177. FUIComponentClass.prototype.executeCallBack = function()
  178. {
  179.    var _loc1_ = this;
  180.    _loc1_.handlerObj[_loc1_.changeHandler](_loc1_);
  181. };
  182. FUIComponentClass.prototype.updateStyleProperty = function(styleFormat, propName)
  183. {
  184.    this.setStyleProperty(propName,styleFormat[propName],styleFormat.isGlobal);
  185. };
  186. FUIComponentClass.prototype.setStyleProperty = function(propName, value, isGlobal)
  187. {
  188.    var _loc1_ = this;
  189.    var _loc2_ = propName;
  190.    if(value != "")
  191.    {
  192.       var tmpValue = parseInt(value);
  193.       if(!isNaN(tmpValue))
  194.       {
  195.          value = tmpValue;
  196.       }
  197.       var global = arguments.length <= 2 ? false : isGlobal;
  198.       if(_loc1_.styleTable[_loc2_] == undefined)
  199.       {
  200.          _loc1_.styleTable[_loc2_] = new Object();
  201.          _loc1_.styleTable[_loc2_].useGlobal = true;
  202.       }
  203.       if(_loc1_.styleTable[_loc2_].useGlobal || !global)
  204.       {
  205.          _loc1_.styleTable[_loc2_].value = value;
  206.          if(!_loc1_.setCustomStyleProperty(_loc2_,value))
  207.          {
  208.             if(_loc2_ == "embedFonts")
  209.             {
  210.                _loc1_.invalidate("setSize");
  211.             }
  212.             else if(_loc2_.subString(0,4) == "text")
  213.             {
  214.                if(_loc1_.textStyle == undefined)
  215.                {
  216.                   _loc1_.textStyle = new TextFormat();
  217.                }
  218.                var textProp = _loc2_.subString(4,_loc2_.length);
  219.                _loc1_.textStyle[textProp] = value;
  220.                _loc1_.invalidate("setSize");
  221.             }
  222.             else
  223.             {
  224.                for(var j in _loc1_.styleTable[_loc2_].coloredMCs)
  225.                {
  226.                   var _loc3_ = new Color(_loc1_.styleTable[_loc2_].coloredMCs[j]);
  227.                   if(_loc1_.styleTable[_loc2_].value == undefined)
  228.                   {
  229.                      var myTObj = {ra:"100",rb:"0",ga:"100",gb:"0",ba:"100",bb:"0",aa:"100",ab:"0"};
  230.                      _loc3_.setTransform(myTObj);
  231.                   }
  232.                   else
  233.                   {
  234.                      _loc3_.setRGB(value);
  235.                   }
  236.                }
  237.             }
  238.          }
  239.          _loc1_.styleTable[_loc2_].useGlobal = global;
  240.       }
  241.    }
  242. };
  243. FUIComponentClass.prototype.registerSkinElement = function(skinMCRef, propName)
  244. {
  245.    var _loc1_ = this;
  246.    var _loc2_ = propName;
  247.    if(_loc1_.styleTable[_loc2_] == undefined)
  248.    {
  249.       _loc1_.styleTable[_loc2_] = new Object();
  250.       _loc1_.styleTable[_loc2_].useGlobal = true;
  251.    }
  252.    if(_loc1_.styleTable[_loc2_].coloredMCs == undefined)
  253.    {
  254.       _loc1_.styleTable[_loc2_].coloredMCs = new Object();
  255.    }
  256.    _loc1_.styleTable[_loc2_].coloredMCs[skinMCRef] = skinMCRef;
  257.    if(_loc1_.styleTable[_loc2_].value != undefined)
  258.    {
  259.       var _loc3_ = new Color(skinMCRef);
  260.       _loc3_.setRGB(_loc1_.styleTable[_loc2_].value);
  261.    }
  262. };
  263. _global.FStyleFormat = function()
  264. {
  265.    var _loc1_ = arguments;
  266.    var _loc2_ = this;
  267.    _loc2_.nonStyles = {listeners:true,isGlobal:true,isAStyle:true,addListener:true,removeListener:true,nonStyles:true,applyChanges:true};
  268.    _loc2_.listeners = new Object();
  269.    _loc2_.isGlo